 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
A heap is a
particular organization of elements in a range
|
|
|
between two
random access iterators [a, b). Its two key
|
|
|
properties are:
|
|
|
1. *a is the largest element in the range.
|
|
2. *a may be removed by the pop_heap algorithm, or a
|
|
|
new element can
be added by the push_heap
|
|
|
algorithm, in O(logN) time.
|
|
|
These properties
make heaps useful as priority
queues.
|
|
|
The heap
algorithms use less than (operator<) as the
|
|
|
default
comparison. In all of the algorithms, an alternate
|
|
comparison
operator can be specified.
|
|